home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / PROGRAM / UCRASM25.ARJ / STRCAT.ASM < prev    next >
Assembly Source File  |  1991-10-12  |  980b  |  61 lines

  1. StdGrp        group    stdlib,stddata
  2. stddata        segment    para public 'sldata'
  3. stddata        ends
  4. ;
  5. stdlib        segment    para public 'slcode'
  6.         assume    cs:stdgrp
  7. ;
  8. ;
  9. ; strcat- Appends one string to the end of another.
  10. ;
  11. ; inputs:
  12. ;
  13. ;    ES:DI- Points at destination string, the one to which the source
  14. ;           string will be appended.
  15. ;
  16. ;    DX:DI- Points at the string to append.
  17. ;
  18. ;
  19. ; Note: The destination string's (ES:DI) buffer must be sufficiently large
  20. ;    to hold the result of the concatentation of the two strings.
  21. ;
  22.         public    sl_strcat
  23. ;
  24. sl_strcat    proc    far
  25.         push    ds
  26.         push    cx
  27.         push    ax
  28.         pushf
  29.         push    si
  30.         push    di
  31. ;
  32.         mov    ds, dx
  33.         cld
  34. ;
  35. ; Find the end of the destination string:
  36. ;
  37.         mov    al, 0
  38.         mov    cx, 0ffffh
  39.     repne    scasb
  40. ;
  41. ; Copy the second string to the end of the current string.
  42. ;
  43.         dec    di
  44. CpyLp:        lodsb
  45.         stosb
  46.         cmp    al, 0
  47.         jnz    CpyLp
  48. ;
  49.         pop    di
  50.         pop    si
  51.         popf
  52.         pop    ax
  53.         pop    cx
  54.         pop    ds
  55.         ret
  56. sl_strcat    endp
  57. ;
  58. ;
  59. stdlib        ends
  60.         end
  61.